import random

class Games:

    def __init__(self, *options):
        """
            Initializes the game
        """
    
        #list of some game images 
        self._gameXimages = [{'image':'/images/aw01-thumb.jpg','game':'Warcraft3'},
                             {'image':'/images/aw02-thumb.jpg','game':'Warcraft3'},
                             {'image':'/images/aw03-thumb.jpg','game':'Warcraft3'},
                             {'image':'/images/aw04-thumb.jpg','game':'Warcraft3'},     
                             {'image':'/images/ss15-off.gif','game':'Diablo2'},
                             {'image':'/images/ss14-off.gif','game':'Diablo2'},
                             {'image':'/images/ss13-off.gif','game':'Diablo2'},
                             {'image':'/images/ss12-off.gif','game':'Diablo2'}]

    def randomImages(self):
        """
            Random the list of images
        """

        elements = self._gameXimages[:]
        randomElements = []
        for i in range(0, len(self._gameXimages)):
            element = random.choice(elements)
            randomElements.append(element['image'])
            elements.remove(element)
        return randomElements
        
    def geImageGame(self, image):
        """
            Returns the game name of the image
        """

        for d in self._gameXimages:
            if d['image'] == image:
                return d['game']
        return ''